﻿using UnityEngine;
using System.Collections;
using ProtoBuf.Message;
using System;

namespace UI
{
    public class UIUnionFightOrderItem : MonoBehaviour
    {
        [HideInInspector]
        public string msgContent;
        public UILabel title;
        public void ClickOrder()
        {
            SendChatTcp();
            UIUnionFightRunMap.GetNetData().SendCSUFTalk(msgContent);
        }

        void SendChatTcp()
        {
            var strs = msgContent.Split(new char[] { '[', ']' }, StringSplitOptions.RemoveEmptyEntries);
            if(strs.Length > 1)
            {
                var msg = new CSChatTcp();
                msg.content = strs[1];
                msg.playerId = StaticData.playerData.playerId;
                msg.chatType = (int)Chat.ChatType.Fight;
                NetAPI.SendSocket(OpDefine.CSChatTcp, msg);
            }
            
        }

        public void SetItem(string title,string msg)
        {
            this.title.text = title;
            msgContent = msg;
        }
    }
}

